﻿using EntityFramework.Entity.Core;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using YouTravel.DomainModels;

namespace Repositories.Configuration
{
    public class InsurancePersonMap : EntityConfigurationBase<InsurancePerson>
    {
        public InsurancePersonMap()
        {
            this.Property(p => p.PolicyHolder).HasMaxLength(20).IsRequired();
            this.Property(p => p.CertificatesType).HasMaxLength(20).IsRequired();
            this.Property(p => p.Number).HasMaxLength(50).IsRequired();
            this.Property(p => p.Phone).HasMaxLength(11).IsRequired();
            this.Property(p => p.Money).HasPrecision(18, 2).IsRequired();

            this.HasRequired(p => p.Insurance).WithMany(p => p.InsurancePersons).HasForeignKey(f => f.InsuranceID);

        }
    }
}
